<?php
/* SVN FILE: $Id: mysql_settings.php 103 2009-07-14 18:03:06Z supersmashbrothers $ */
/**
* ibMarket 2
* IP.Board 3.0
* ibMarket obtains the fields for members table
*
* @author $Author: supersmashbrothers $
* @copyright $Copyright$
* @version $Revision: 103 $
* @lastrevision $Date: 2009-07-14 18:03:06 +0000 (Tue, 14 Jul 2009) $
* @modifiedby $LastChangedBy: supersmashbrothers $
* @lastmodified $LastChangedDate: 2009-07-14 18:03:06 +0000 (Tue, 14 Jul 2009) $
* @filesource $URL: http://ipb-ibmarket.googlecode.com/svn/ibmarket2/trunk/admin/applications_addon/other/ibmarket/sql/mysql_settings.php $
*/
class settings_fields
{
	public static $no_fields = array(
									 'joined',
									 'warn_level',
									 'warn_lastwarn',
									 'last_post',
									 'bday_day',
									 'bday_month',
									 'bday_year',
									 'msg_count_new',
									 'msg_count_total',
									 'msg_count_reset',
									 'msg_show_notification',
									 'last_visit',
									 'last_activity',
									 'sub_end',
									 'member_login_key_expire',
									 'members_disable_pm',
									 'members_profile_views',
									 'members_bitoptions',
									 'fb_uid',
									 'fb_emailallow',
									 'fb_lastsync',
									 'market_tax',
									 );
	
	public static function getFields()
	{
		ipsRegistry::DB()->build(array('select'=>'*','from'=>'members','limit'=>1));
		$fields = ipsRegistry::DB()->getResultFields(ipsRegistry::DB()->execute());
		
		$f = array();
		foreach($fields as $field)
		{
			if((isset($field->numeric) && !$field->numeric) || $field->unique_key || $field->primary_key || in_array($field->name,self::$no_fields) || (is_string($field->type) && strstr($field->type,'int') === FALSE) || (is_numeric($field->type) && !in_array($field->type,array(0,3,4,5,8))))
			{
				continue;
			}
			
			if(strstr('time',$field->name) !== FALSE)
			{
				continue;
			}
			
			$f[$field->name] = $field->name;
		}
		
		return $f;
	}
	
	private function __construct() {}
}
?>